<template>
<h2>歌曲信息 {{songid}}</h2>
</template>
<script setup lang="ts">
import { useRoute } from "vue-router";
import { ref,watch } from "vue";
const route = useRoute();

const songid = ref<string>("")
if (route.query){
  console.log("页面传参",route.query)
  songid.value = <string>route.query.id
}

// 监听路由参数变化
watch(
  () => route.query.id,
  (newId) => {
    console.log("路由参数变化", newId);
    songid.value = newId as string; // 更新 songid
  }
);

</script>
<style scoped lang="scss">

</style>
